home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14616 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  48 lines

  1. Path: news.bellglobal.com!news
  2. From: bogdanfl@aei.ca (Bogdan  Florescu)
  3. Newsgroups: comp.lang.c++
  4. Subject: HELP with a simple C Structure
  5. Date: Sun, 31 Mar 1996 17:02:51 GMT
  6. Organization: Bell Global Solutions
  7. Message-ID: <4jm38u$j1a@news.bellglobal.com>
  8. NNTP-Posting-Host: diala07.aei.ca
  9. X-Newsreader: Forte Free Agent 1.0.82
  10.  
  11. I need to do this, and I don't khow how.
  12.  
  13. struct Employee
  14.     {
  15.     float salary;
  16.     char department;
  17.     }
  18.  
  19. Employee Jim, Paul, Pat, Scott;
  20.  
  21. void main(void)
  22.     {
  23.     Jim.salary=15;
  24.     Paul.salary=14;
  25.     Pat.salary=13;
  26.     Scott.salary=12;
  27.  
  28.     Jim.department='a';
  29.     Paul.department='b';
  30.     Pat.department='c';
  31.     Scott.department='b';
  32.     ................................
  33.     }
  34.  
  35. I need to replace the dots with a program that tells me who else works
  36. in Paul's department and how much money he makes.
  37.  
  38. I would like to have the structure variables named with the name of
  39. the employee, (instead of an array with the name of the employee as a
  40. member) so I can easily access their members. The structure can be
  41. modified, but I really need to be able to have expressions such as
  42. Jim.salary.
  43.  
  44. Thank you,
  45. Bogdan Florescu
  46.  
  47.  
  48.